package com.sing.java8;

import com.alibaba.fastjson.JSON;
import org.json.JSONObject;

import java.util.Arrays;
import java.util.List;

public class Test {
    //java8
    //Lambda 表达式

    public static void main(String[] args) {
       List<String> list= Arrays.asList("6","5","1","2","3","4");

       list.forEach( a ->{
                   Student s = new Student();
                   s.setName(a);
                   System.out.println(JSON.toJSON(s));
               }
               );

        System.out.println("list begin-->"+JSON.toJSON(list));
        list.sort(( a, b ) -> a.compareTo( b ) );
        System.out.println("list end--->"+JSON.toJSON(list));
        //函数式接口





    }

}
